cmake_minimum_required(VERSION 3.10)

project(learn_opengl)

# 当pkg-config配置的库不在pkg指定的搜索目录下时，需要自己指定目录
# set(ENV(PKG_CONFIG_PATH) "/home/jam/xxxx")
find_package(PkgConfig)
# !需要使用IMPORTED_TARGET才能通过PkgConfig找到对应的包
pkg_search_module(glu REQUIRED IMPORTED_TARGET glu)
# pkg_search_module(glm REQUIRED IMPORTED_TARGET glm)
# pkg_search_module(glfw3 REQUIRED IMPORTED_TARGET glfw3)

set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR})
add_compile_options("-Wall")

include_directories(
    tools/window
    tools/shader
)

# aux_source_directory(tools/window TOOLS_SRC)
# 递归查找cpp源文件
file(GLOB_RECURSE TOOLS_SRC "tools/*.cpp")

add_library(tool STATIC ${TOOLS_SRC})
target_link_libraries(tool PRIVATE
    PkgConfig::glu glut
)

macro(build_test example)
    add_executable(${example} test/${example}.cpp)
    target_link_libraries(${example} PRIVATE
        tool
        assimp
    )
endmacro()


# build_test(test_assimp)
# build_test(test_glut)
build_test(test_shader)
